﻿// ==UserScript==
// @name         user-web-local
// @namespace    https://user-web.googlecode.com/
// @version      0.5
// @description  insert user styles
// @match        http*://*/*
// @match        http://localhost:4444/TestLive.htm
// @match        https://localhost:44300/TestLive.htm
// @exclude      http://localhost*
// @exclude      */owa/*
// @exclude      https://www.google.co.uk/_/chrome/newtab*
// @exclude      https://mail.google.com/tasks/*
// @exclude      http*://www.google.co.uk*
// @exclude      http*://*.facebook.com*
// @exclude      http*://rs.gwallet.com*
// @exclude      http*://*.struq.com*
// @exclude      http*://www.google.com*
// @copyright    2010+, james_zerty
// @require      https://localhost:44300/Scripts/jquery/jquery-2.1.0.js
// @require      https://localhost:44300/Scripts/jquery/jquery-ui-1.10.4.custom.min.js
// @require      https://localhost:44300/Scripts/UserScripts/user-web-full.js?123456789
// ==/UserScript==

var useLocal = 1;
var uniqueUrl = useLocal ? '?' + new Date().valueOf() : '';
var root = useLocal ? 'https://localhost:44300/' : 'https://user-web.googlecode.com/svn/trunk/';

LoadStyle("user-web", uniqueUrl);

function LoadStyle(fileName, uniqueUrl) {
    var src = root + 'Styles/' + fileName + '.css' + uniqueUrl;

    if (document.getElementById(fileName) == null) {
        var s = document.createElement('link');
        s.setAttribute('id', fileName + "-style");
        s.setAttribute('href', src);
        s.setAttribute('rel', 'stylesheet');
        s.setAttribute('type', 'text/css');
        s.setAttribute('data-local', useLocal);
        document.head.appendChild(s);
    }
    else {
        document.getElementById(fileName).href = src;
    }
}